<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><#if isAddAction>添加<#else>编辑</#if>耗材信息</title>
<#include "/admin/common_css.ftl">
<#include "/admin/common_js.ftl">
<script type="text/javascript" src="${base}/apache/common/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/apache/common/js/jquery.validate.methods.js"></script>
<script type="text/javascript" src="${base}/apache/common/editor/kindeditor.js"></script>
<script charset="utf-8" src="${base}/apache/common/editor/lang/zh_CN.js"></script>
<script type="text/javascript" src="${base}/apache/date97/WdatePicker.js"></script>


<script type="text/javascript">
$(function() {
	var $validateErrorContainer = $("#validateErrorContainer");
	var $validateErrorLabelContainer = $("#validateErrorContainer ul");
	var $validateForm = $("#validateForm");
	
	// 表单验证
	$validateForm.validate({
		errorContainer: $validateErrorContainer,
		errorLabelContainer: $validateErrorLabelContainer,
		wrapper: "li",
		errorClass: "validateError",
		ignoreTitle: true,
		rules: {
			"sn": {
				required: true
			},
			"name": "required",
			"manufacturingDate": "required",
			"standard": "required",
			"unit": "required",
			"limityears": {
				required : true,
				digits : true
			},
			"price": {
				required: true,
				min: 0
			}
		},
		messages: {
			"sn": "请填写编号",
			"name": "请填写名称",
			"manufacturingDate": "请填写生产日期",
			"standard": "请填写型号规格",
			"unit": "请填写计量单位",
			"limityears": "年限必须为零或正整数",
			"price": "单价必须为零或正数",
		},
		submitHandler: function(form) {
			$(form).find(":submit").attr("disabled", true);
			form.submit();
		}
	});	
});

</script>
</head>
<body class="input">
	<div class="bar">
		<#if isAddAction>添加耗材<#else>编辑耗材</#if>
	</div>
	<div id="validateErrorContainer" class="validateErrorContainer">
		<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
		<ul></ul>
	</div>
	<div class="body">
		<form id="validateForm" enctype="multipart/form-data" action="<#if isAddAction>save<#else>../update</#if>" method="post">
			<input type="hidden" name="id" value="${(consumable.id)!}" />
			<table class="inputTable">
				<tr>
					<th>
						物品编号: 
					</th>
					<td>
						<input type="text" name="sn" class="formText" value="${(consumable.sn)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						物品名称: 
					</th>
					<td>
						<input type="text" name="name" class="formText" value="${(consumable.name)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						物品类型: 
					</th>
					<td>
					   <select name="category">
							<option value="1" <#if (consumable.category)??&&consumable.category == 1> selected</#if>>
								药剂
							</option>
							<option value="2" <#if (consumable.category)??&&consumable.category == 2> selected</#if>>
								耗材
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<th>
						生产日期: 
					</th>
					<td>
						<input type="text" name="manufacturingDate" class="formText" value="${(consumable.manufacturingDate)!}"  onclick="WdatePicker()"/>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						型号规格: 
					</th>
					<td>
						<input type="text" name="standard" class="formText" value="${(consumable.standard)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						计量单位: 
					</th>
					<td>
						<input type="text" name="unit" class="formText" value="${(consumable.unit)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						保存位置: 
					</th>
					<td>
						<input type="text" name="position" class="formText" value="${(consumable.position)!}" />
					</td>
				</tr>
				<tr>
					<th>
						保存年限: 
					</th>
					<td>
						<input type="text" name="limityears" class="formText" value="${(consumable.limityears)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						单价: 
					</th>
					<td>
						<input type="text" name="price" class="formText" value="${(consumable.price)!"0"}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						产地: 
					</th>
					<td>
						<input type="text" name="place" class="formText" value="${(consumable.place)!}" />
					</td>
				</tr>
				<tr>
					<th>
						备注: 
					</th>
					<td>
						<input type="text" name="commonts" class="formText" value="${(consumable.commonts)!}" />
					</td>
				</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="确  定" hidefocus />&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus />
			</div>
		</form>
	</div>
</body>
</html>